package zolmain;

import java.util.ArrayList;
import java.util.List;

import db.MYSQLControl;
import model.ProductModel;
import parse.Parse;
import utils.HttpJsoupUtil;
import org.apache.http.ParseException;

public class ProductCrawler {
    public static void main(String[] args) throws ParseException {
        List<String> urlList = new ArrayList<>();
        for (int i = 1; i < 50; i++) { //爬取50页数据
            urlList.add("https://product.pconline.com.cn/icebox/" + 25 * (i - 1) + "s1.shtml");
        }
        List<ProductModel> listData = new ArrayList<>();
        HttpJsoupUtil util = new HttpJsoupUtil();
        for (String s : urlList) {
            //获取HTML
            String html = util.getHTML(s);
            //解析HTML
            Parse.getProductData(html, listData);
        }
        //存储数据
        MYSQLControl.executeInsert_Pro(listData);
    }

}